package com.t2t.top.servlet;

import com.t2t.top.util.ConfigFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Properties;

/**
 * Created by yangpengfei on 2016/1/3.
 */
public class HelloServlet extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Properties p = ConfigFactory.getFactory().getLocalConfig();
        String str = "";
        for (Object o : p.keySet()) {
            str += "<br>{0}={1}".replace("{0}", o + "").replace("{0}", p.getProperty(o + ""));
        }
        response.getOutputStream().println("docker web!" + str);
    }
}
